package cn.ac.ict.fpevaluation.evaluation;

import cn.ac.ict.fpevaluation.bean.ApResponse;
import cn.ac.ict.fpevaluation.bean.AtomTrajectoryBean;
import cn.ac.ict.fpevaluation.utils.DataOperationToDiskUtils;

import java.util.List;

/**
 * Created by wuyouxiong on 2017/3/6.
 */
public class WifiEvaluationHelper {

    public static void launch() {

        List<AtomTrajectoryBean> originalData = DataOperationToDiskUtils.getOriginalData();

        WifiEvaluation wifi = WifiEvaluation.getInstance();

        System.out.println("母本的步数: " + originalData.get(1).getStepList().size());
        System.out.println("样本的步数: " + originalData.get(0).getStepList().size());

        System.out.println("实验准备条件: 1. 样本和母本中采集的数据必须是连续的; 2. 样本和母本中采集的数据个数必须大于某一阈值" +
                "3. 样本和母本中采集的数据的个数必须和步数一致(一步采集一次WIFI); 4. ");

        List<ApResponse> movedAps = wifi.findMovedAps(wifi.atom2TrajWrapped(originalData.get(1)), wifi.atom2TrajWrapped(originalData.get(0)));

        if (movedAps != null) {
            System.out.println("移动的Ap有");
            movedAps.forEach((apResponse) -> {
                if (apResponse.isMoved()) {
                    System.out.println(apResponse.getMac() + "; " + apResponse.getLog());
                }
            });
            System.out.println("其他Ap的信息");
            movedAps.forEach((apResponse) -> {
                if (!apResponse.isMoved()) {
                    System.out.println(apResponse.getMac() + "; " + apResponse.getLog());
                }
            });
        } else {
            System.out.println("没有AP发生位置移动");
        }

    }
}
